dynamics_frequency_sweep Module



Contents


Interfaces

public interface frequency_sweep

  • private function frf_sweep_1(fcn, freq, iv, solver, ncycles, ntransient, points, inHz, args) result(rst)

    Computes the frequency response of each equation of a system of harmonically excited ODE's by sweeping through frequency.

    The amplitude and phase are determined by means of a harmonic projection method.

    For uniformly sampled data, the retained complex response is with phase

    where

    Arguments

    Type IntentOptional Attributes Name
    procedure(harmonic_ode), intent(in), pointer :: fcn

    A pointer to the routine containing the ODE's to integrate.

    real(kind=real64), intent(in), dimension(:) :: freq

    An M-element array containing the frequency points at which the solution should be computed. Notice, whatever units are utilized for this array are also the units of the excitation_frequency property in fcn. Additionally, this array cannot contain any zero-valued elements as the ODE solution time for each frequency is determined by the period of oscillation and number of cycles.

    real(kind=real64), intent(in), dimension(:) :: iv

    An N-element array containing the initial conditions for each of the N ODEs.

    class(ode_integrator), intent(inout), optional, target :: solver

    An optional differential equation solver. The default solver is the Dormand-Prince Runge-Kutta integrator from the DIFFEQ library.

    integer(kind=int32), intent(in), optional :: ncycles

    An optional parameter controlling the number of cycles to analyze when determining the amplitude and phase of the response. The default is 5.

    integer(kind=int32), intent(in), optional :: ntransient

    An optional parameter controlling how many of the initial "transient" cycles to ignore. The default is 30.

    integer(kind=int32), intent(in), optional :: points

    An optional parameter controlling how many evenly spaced solution points should be considered per cycle. The default is 1000.

    logical, intent(in), optional :: inHz

    Set to true if the units of the frequency vector are in Hz. If false, the units are assumed as rad/s. The default is false such that the frequency units are assumed to be rad/s.

    class(*), intent(inout), optional :: args

    An optional argument allowing for passing of data in/out of the fcn subroutine.

    Return Value type(frf)

    The resulting frequency responses.

  • private function frf_sweep_2(fcn, nfreq, freq1, freq2, iv, solver, ncycles, ntransient, points, inHz, args) result(rst)

    Computes the frequency response of each equation of a system of harmonically excited ODE's by sweeping through frequency.

    The amplitude and phase are determined by means of a harmonic projection method.

    For uniformly sampled data, the retained complex response is with phase

    where

    Arguments

    Type IntentOptional Attributes Name
    procedure(harmonic_ode), intent(in), pointer :: fcn

    A pointer to the routine containing the ODE's to integrate.

    integer(kind=int32), intent(in) :: nfreq

    The number of frequency values to analyze. This value must be at least 2.

    real(kind=real64), intent(in) :: freq1

    The starting frequency.

    real(kind=real64), intent(in) :: freq2

    The ending frequency.

    real(kind=real64), intent(in), dimension(:) :: iv

    An N-element array containing the initial conditions for each of the N ODEs.

    class(ode_integrator), intent(inout), optional, target :: solver

    An optional differential equation solver. The default solver is the Dormand-Prince Runge-Kutta integrator from the DIFFEQ library.

    integer(kind=int32), intent(in), optional :: ncycles

    An optional parameter controlling the number of cycles to analyze when determining the amplitude and phase of the response. The default is 5.

    integer(kind=int32), intent(in), optional :: ntransient

    An optional parameter controlling how many of the initial "transient" cycles to ignore. The default is 30.

    integer(kind=int32), intent(in), optional :: points

    An optional parameter controlling how many evenly spaced solution points should be considered per cycle. The default is 1000.

    logical, intent(in), optional :: inHz

    Set to true if the units of the frequency units are in Hz. If false, the units are assumed as rad/s. The default is false such that the frequency units are assumed to be rad/s.

    class(*), intent(inout), optional :: args

    An optional argument allowing for passing of data in/out of the fcn subroutine.

    Return Value type(frf)

    The resulting frequency responses.

interface

  • public subroutine harmonic_ode(freq, t, x, dxdt, args)

    Defines a system of ODE's exposed to harmonic excitation.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in) :: freq

    The excitation frequency.

    real(kind=real64), intent(in) :: t

    The current time step value.

    real(kind=real64), intent(in), dimension(:) :: x

    The value of the solution estimate at time t.

    real(kind=real64), intent(out), dimension(:) :: dxdt

    The derivatives as computed by this routine.

    class(*), intent(inout), optional :: args

    An optional argument allowing the passing of data in/out of this routine.

interface

  • public function ode_excite(t) result(rst)

    Defines the interface for a ODE excitation function.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in) :: t

    The value of the independent variable at which to evaluate the excitation function.

    Return Value real(kind=real64)

    The result.


Functions

public pure elemental function chirp(t, amp, span, f1Hz, f2Hz) result(rst)

Evaluates a linear chirp function. The instantaneous frequency varies linearly, giving phase and response .

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: t

The value of the independent variable at which to evaluate the chirp.

real(kind=real64), intent(in) :: amp

The amplitude.

real(kind=real64), intent(in) :: span

The duration of the time it takes to sweep from the start frequency to the end frequency.

real(kind=real64), intent(in) :: f1Hz

The lower excitation frequency, in Hz.

real(kind=real64), intent(in) :: f2Hz

The upper excitation frequency, in Hz.

Return Value real(kind=real64)

The value of the function at t.